import Taro, { Component } from '@tarojs/taro'
import { View, Text,Image } from '@tarojs/components'
import {$navigateTo, getGlobalData} from '../../../../global'
import './cashwithdrawal.css'
import { AtButton,AtInput, AtFloatLayout,AtRadio,AtIcon,AtListItem } from 'taro-ui'
import reactMixin from 'react-mixin';
import myJs from './cashwithdrawalJs.js'
import app from '../../../../main.js'

export default class CashWithdrawal extends Component {

  config = {
    navigationBarTitleText: '提现'
  }
  constructor () { 
        super(...arguments); 
        this.state = this.getData(); 
    }
  init(){
    this.setState({
      open:false,
      value:''
    })
  }
 

  go=(url)=>{
    $navigateTo(url);
  }

  render () {
    return (
      <View className='cash-withdrawal'>
        <View className='box'>
            <View className='top at-row'>
                <View className='at-col at-col-4 title'>到账银行卡</View>
                <View className='at-col at-col-5'>
                    <View className='bank' onClick={this.handleChange.bind(this,'open')}>招商银行(5256)</View>
                    <View className='get-time'>2小时到账</View>
                </View>
            </View>
            <View className='bottom'>
                <View className='title'>提现金额</View>
                <View className='money'>
                    {/* <AtIcon prefixClass='fa' value='cny' size='40' color='#000000' className='money-icon'></AtIcon> */}
                    <Image className='img' src={getGlobalData('baseurl')+'img/rmb.png'}></Image>
                    <View className='input-box'>
                        <AtInput
                            name='value'
                            type='text'
                            value={this.state.withdraw_money.money}
                            onChange={this.handleChange.bind(this,'withdraw_money.money')}
                        />
                    </View>
                    <View className='tips'>
                        当前余额剩余300元，
                        <Text className='all'>全部提现</Text>
                    </View>
                    <View className='btn-box'>
                      <AtButton className='btn'>提现</AtButton>
                    </View>
                </View>
            </View>
        </View> 
        <AtFloatLayout isOpened={this.state.open} title="选择银行卡(请留意各银行到账时间)">
            <AtRadio
            options={
                this.state.doctor_banks.items.map((item)=>{
                      return {
                        label:item.bank_name+'('+item.bank_number.substr(item.bank_number.length-4)+')',
                        value:item.id,
                        desc:"2小时内到账"
                      }
                })
            }
            value={this.state.value}
            onClick={this.handleChange.bind(this,'value')}
          />
        </AtFloatLayout>   
      </View>
    )
  }
}
reactMixin.onClass(CashWithdrawal,myJs);
